package com.myway.core.common;

import java.util.HashMap;

public enum YHOrderStatus {
	CANCEL("CALCEL"),	//取消订单
	CANCELB2C("CALCELB2C"),	//B2C审核取消
	CANCELYH("CALCELYH"),	//取消一嗨
	CANCELIN("CALCELIN"),	//退款中
	CANCELVC("CANCELVC"),//完成退款
	CANCELFAIL("CANCELFAIL"),//退款失败
	FINISH("FINISH"),	//已支付
	FINISHIN("FINISHIN"),	//支付中
	FINISHVC("FINISHVC"),	//已下单
	
	//===================对一嗨
	GSINGLE("GSINGLE"),//抢单
	INPLACE("INPLACE"),//就位
	SERVICE("SERVICE"),//开始服务
	OFINISH("OFINISH");//订单完成

	
	
	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the action enum with alias name as key.
	 */
	private static HashMap<String, YHOrderStatus> map;

	/**
	 * Construct the hash map at load time
	 */
	static 
	{
		map = new HashMap<String, YHOrderStatus>();
		for (YHOrderStatus type : YHOrderStatus.values()) {
			map.put(type.alias, type);
		}
	}

	YHOrderStatus(String alias) 
	{
		this.alias = alias;
	}

	@Override
	public String toString()
	{
		return this.alias;

	}

	/**
	 * Return a <code>Action</code> object holding the value of specified alias name
	 *
	 * @param alias
	 *            the alias name of the type
	 *
	 * @return a <code>Action</code> object holding the value represented by the alias name
	 *         argument
	 */
	public static YHOrderStatus valueOfAlias(String alias) 
	{
		YHOrderStatus type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException("Unknown action alias [" + alias + "]");
		}

		return type;
	}

	/**
	 * @return the alias
	 */
	public String getAlias() {
		return this.alias;
	}
	
	
	
	
	
}
